import { root } from "../apiRoot";
import { defHttp } from '@/utils/http';
import type { HoldApiData, SetHoldData } from "./types";

export const Api = {
  getHoldData: root + 'cache/get',
  setHoldData: root + 'cache/set',
  removeHoldData: root + 'cache/remove',
}

/**
 * @description 获取暂存的缓存数据
 * @date 24/03/2023
 * @export
 * @param {HoldApiData} data
 */
export function getHoldDataApi(data: HoldApiData) {
  return defHttp.get<string>({
    url: Api.getHoldData,
    data
  })
}

/**
 * @description 设置暂存的缓存数据
 * @date 24/03/2023
 * @export
 * @param {SetHoldData} data
 */
export function setHoldDataApi(data: SetHoldData) {
  return defHttp.post({
    url: Api.setHoldData,
    data
  })
}

/**
 * @description 删除暂存的缓存数据
 * @date 24/03/2023
 * @export
 * @param {HoldApiData} data
 */
export function removeHoldDataApi(data: HoldApiData) {
  return defHttp.get({
    url: Api.removeHoldData,
    data
  })
}